package org.fast.easy.system.upms.domain.vo;

import lombok.Data;
import org.fast.easy.core.util.StringUtils;

import java.io.Serial;
import java.io.Serializable;

/**
 * 类说明
 *
 * @author YanMing
 * @date 2024/6/19
 */
@Data
public class SysUserScheduleVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
    * 租户编号
    */
    private String tenantId;
    /**
    * 用户ID
    */
    private Long userId;


    private String scheduleTitle;

    private Integer scheduleFullDay;

    private Integer scheduleDuplicate;

    private Integer scheduleRemind;

    private String scheduleAddress;

    private String scheduleRemark;

    private String[] scheduleDateTime = new String[2];

    private String scheduleStartDateTime;
    private String scheduleEndDateTime;
    private String scheduleStartDate;
    private String scheduleEndDate;

    private String scheduleStartTime;
    private String scheduleEndTime;

    public void setScheduleStartDateTime(String scheduleStartDateTime) {
        this.scheduleStartDateTime = scheduleStartDateTime;
        this.scheduleDateTime[0] = scheduleStartDateTime;
    }

    public void setScheduleEndDateTime(String scheduleEndDateTime) {
        this.scheduleEndDateTime = scheduleEndDateTime;
        this.scheduleDateTime[1] = scheduleEndDateTime;
    }

    public void setScheduleDateTime(String[] scheduleDateTime) {
        this.scheduleDateTime = scheduleDateTime;
        if(scheduleDateTime!=null && scheduleDateTime.length ==2){
            if(StringUtils.isNotBlank(scheduleDateTime[0]) && StringUtils.isNotBlank(scheduleDateTime[1])){
                this.scheduleStartDateTime = scheduleDateTime[0];
                this.scheduleEndDateTime = scheduleDateTime[1];

                String[] start = scheduleDateTime[0].split(" ");
                String[] end = scheduleDateTime[1].split(" ");
                if(start!=null && start.length ==2){
                    this.scheduleStartDate = start[0];
                    this.scheduleStartTime = start[1];
                }
                if(end!=null && end.length ==2){
                    this.scheduleEndDate = end[0];
                    this.scheduleEndTime = end[1];
                }
            }
        }


    }
}
